CREATE TABLE [dbo].[StatusWork]
(
[Ik_TypeEvent] [int] NOT NULL,
[idUspevDocs] [int] NOT NULL,
[Date_St] [date] NOT NULL,
[Approved] [bit] NULL,
[NoApproved] [bit] NULL,
[Comment] [varchar] (500) COLLATE Cyrillic_General_CI_AS NULL
)
GO
ALTER TABLE [dbo].[StatusWork] ADD CONSTRAINT [StatusWorkPrimary] PRIMARY KEY CLUSTERED  ([Ik_TypeEvent], [idUspevDocs])
GO
CREATE NONCLUSTERED INDEX [idx_Date_St] ON [dbo].[StatusWork] ([Date_St])
GO
ALTER TABLE [dbo].[StatusWork] ADD CONSTRAINT [StatusWorkIDWorkStudentForeign] FOREIGN KEY ([idUspevDocs]) REFERENCES [dbo].[UspevKPTheme] ([idUspevDocs]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[StatusWork] ADD CONSTRAINT [StatusWorkTypeEventForeign] FOREIGN KEY ([Ik_TypeEvent]) REFERENCES [dbo].[TypeEvent] ([Ik_TypeEvent])
GO
